import Phaser from 'phaser';

import UtilsBar from '../../../utils/Utils.Bar/UtilsBar';
import UtilsCoordinateConter from '../../../utils/Utils.coordinate.conter/UtilsCoordinateConter';
import SaveSceneExampleQueue from '../../../utils/Utils.SaveSceneExampleQueue/UtilsSaveSceneExampleQueue';

export default class SceneUiBar extends Phaser.Scene {
    constructor() {
        super({
            key: 'SceneUiBar'
        });

        this.WWC = UtilsCoordinateConter.coordinatrConter('world').WWC;
        this.WHC = UtilsCoordinateConter.coordinatrConter('world').WHC;
        this.WFW = UtilsCoordinateConter.coordinatrConter('worldFull').WFW;
        this.WFH = UtilsCoordinateConter.coordinatrConter('worldFull').WFH;
        this.VWC = UtilsCoordinateConter.coordinatrConter('view').VWC;
        this.VHC = UtilsCoordinateConter.coordinatrConter('view').VHC;
        this.VFW = UtilsCoordinateConter.coordinatrConter('viewFull').VFW;
        this.VFH = UtilsCoordinateConter.coordinatrConter('viewFull').VFH;
    }

    init() {
        console.log('SceneUiBar init!');

        SaveSceneExampleQueue.enQueue({
            'SceneUiBar': this
        });
    }

    preload() {
        console.log('SceneUiBar pre!');

    }

    create() {
        console.log('SceneUiBar create!');

    }

    showHomeBar(callback) {
        new UtilsBar('', {
            x: this.VWC - this.VWC / 2,
            y: this.VHC + 240,
            w: this.VWC,
            h: 20,
            color: 0xf7cf57,
            radius: 3,
            showText: '回城中:',
            text: {
                x: 0.5,
                y: -1
            },
            timeOut: 500,
            timeNum: .1
        }, this, (e) => {
            callback(e);
        });
    }

}